package com.hsh.erp.controller;

import com.hsh.erp.domain.common.Result;
import com.hsh.erp.service.FileService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/file")
@Tag(name = "文件操作", description = "文件操作")
public class FileController {

    @Resource
    private FileService fileService;

    /**
     * 读取并解析店铺导出文件,
     * 写入快递导入文件
     *
     * @return
     */
    @GetMapping("/writeExpressImport/{shop}/{express}")
    @Operation(summary = "读取并解析店铺导出文件,写入快递导入文件")
    public Result writeExpressImport(@PathVariable String shop, @PathVariable String express, String dateStr, String password) {
        return fileService.writeExpressImport(shop, express, dateStr, password);
    }

    /**
     * 导入发货文件,
     * 导入订单到系统中
     *
     * @return
     */
    @GetMapping("/importOrder/{shop}/{express}")
    @Operation(summary = "导入发货文件,导入订单到系统中")
    public Result importOrder(@PathVariable String shop, @PathVariable String express, String dateStr) {
        return fileService.importOrder(shop, express, dateStr);
    }
}
